<?php
/**
 * 系统字典 api
 * User: xwc
 * Date: 2023/3/30 17:28
 */

namespace App\OpenApi\AppApi\Sys;

use App\Service\Core\Sys\Dict\SysDictService;
use App\Service\OpenApi\AppApi\OpenBaseApi;

class SysDictApi extends OpenBaseApi
{
    /**
     * 获取字典名称列表
     * @return array
     */
    public function dict()
    {
        $SysDictService = SysDictService::getInstance();
        $dict_list = $SysDictService->getItemTreeList();
        return alert_info(0, 'ok', $dict_list);
    }

    /**
     * 获取字典值集合
     * @return array
     */
    public function dictAll()
    {
        $dict_item = trim($this->input('dict_item'));
        $dict_list = [];
        if (!empty($dict_item)) {
            $SysDictService = SysDictService::getInstance();
            $dict_list = $SysDictService->getDictAll($dict_item);
        }
        return alert_info(0, 'ok', $dict_list);
    }
}
